-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix persisting of inherited class constants #14114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't comment on the fix, but I can confirm that the failing test cases for #[\Deprecated]
are fixed with this patch and that the added test looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double check if this doesn't make troubles for Windows (different workers may have internal constants at different addresses) and run tests with "--repeat 3" before merging this.
Personally, I would move code from zend_persist_class_entry()
into zend_persist_class_constant()
, because it already contains logic related to decision about persistence. With your patch part of this logic is duplicated.
1522e6b
to
054e46c
Compare
@dstogov Thanks your your comment.
As hinted by you in the private chat, php-src/Zend/zend_inheritance.c Lines 2840 to 2843 in 6fed9a9
Hence, such a class is not be possible on Windows. I had to add an additional clause for
Done!
I added it there only because |
Custom internal attributes are not supported in stubs until PHP 8.3. I will merge this change into PHP 8.2 and then commit the test separately for PHP 8.3+. |
According to the failed build, I'll still need |
Class constants are inherited to user classes without cloning. Thus, internal class constants should not be persisted at all. Simply keep pointing to the internal class constant. Fixes phpGH-14109
Class constants are inherited to user classes without cloning. Thus, internal class constants should not be persisted at all. Simply keep pointing to the internal class constant. If the internal class constants are persisted, the attempt to free the
attributes
hash map after persistence will fail, because it's persistently allocated.Fixes GH-14109
This will need to be rebased to PHP-8.2. I target master for now only because
ZendAttributeTest
doesn't exist on lower branches, and I was too lazy to backport.